import request from '@/router/axios'
import store from '@/store'
import { get_month_first,get_month_last, get_date } from '@/const/crud/rca/common.js'
export const startDate = get_month_first(0);
export const endDate = get_date(0);
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  menu:false,
  editBtn: false,
  emptyBtn:false,
  delBtn: false,
  align: 'center',
  selection: true,
  reserveSelection:true,
  addBtn: false,
  showSummary: true,
  sumColumnList: [
    {
      name: 'amount',
      type: 'sum'
    },{
      name: 'money',
      type: 'sum'
    },{
      name: 'stockMoney',
      type: 'sum'
    },{
      name: 'stockAmount',
      type: 'sum'
    },{
      name: 'diffAmount',
      type: 'sum'
    },{
      name: 'diffMoney',
      type: 'sum'
    }
  ],
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    hide: true
  }, {
    width: 100,
    hide: false,
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    search: true,
    filterable : true,
    cascaderItem: ["stationCode"],
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getLineLists?userCode="+ store.getters.userInfo.userCode,
    display: true // 动态显隐控制不能删除
  }, {
    width: 180,
    hide: false,
    label: '站点',
    prop: 'stationCode',
    type: 'select',
    search: true,
    filterable : true,
    dicFlag: false,
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/check/check/getStationLists?userCode="+ store.getters.userInfo.userCode + "&lineCode={{key}}",
    display: true// 动态显隐控制不能删除
  },{
    label: '交易日期',
    prop: 'tradeTime',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    searchValue: [startDate, endDate], 
    searchSpan: 12,
    searchRange: true,
    width: 100,
    type:'date',
    hide: false,
    search: true
  },{
    width: 200,
    label: '票种',
    prop: 'ticketType',
    type: 'select',
    props: {
      label: 'SUB_NAME',
      value: 'SUB_EN_NAME'
    },
    dicUrl: "/check/check/getpm_ticket_card_type_param",
    hide: false,
    search: true
  },{
    hide: true,
	label: '数量',
    prop: 'amount'
  },{
    label: '合计金额',
    prop: 'money',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    },
    hide: false,
    search: false
  },{
    width: 120,
    label: '库存售卖数量',
    prop: 'stockAmount',
    search: false,
    hide: true
  }, {
    width: 200,
    label: '差异(数量-库存售卖数量)',
    prop: 'diffAmount',
    search: false,
    hide: true,
  },{
    width: 120,
    label: '配票售卖金额',
    prop: 'stockMoney',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    },
    search: false,
    hide: false
  }, {
    width: 200,
    label: '差异(合计金额-配票售卖金额)',
    prop: 'diffMoney',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    },
    search: false,
    hide: false,
  }, {
    label: '确认状态',
    prop: 'confirmStatus',
    search: true,
    type: 'select',
    dicData: [{
      label: '未确认',
      value: '0'
    }, {
      label: '已确认',
      value: '1'
    }],
    formatter:function(row, value , label, column){
      return value == 1?'已确认':'未确认';
    },
    hide: false,
  }, {
    type: 'input',
    prop: "creatorName",
    label: "确认人",
    width: 120,
  }, {
    type: 'date',
    prop: "confirmTime",
    label: "确认时间",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 120,
  }, {
    type: 'textarea',
    prop: "remark",
    label: "备注信息",
    width: 200,
  }]
}
export function getSwAuMarketingTicket(param) {
  return request({
    url: '/check/check/getSwAuMarketingTicket',
    method: 'post',
    params: param
  })
}
export function updateSwAuMarketingTicket(param) {
  return request({
    url: '/check/check/updateSwAuMarketingTicket',
    method: "put",
    params: param
  })
}

export const tableOptionRemark = {
  
  submitBtn: false,
  emptyBtn: false,
  column: [{
    type: 'textarea',
    prop: "remark",
    label: "备注信息",
    span: 20,
    cell: true,
  }]
}